cloth(dresses, dress1, darkBlue, long, summer, pois,overall).
%cloth(dresses, dress4, darkBlue, long, summer, pois,overall).
%cloth(dresses, dress2, orange, short, summer, pois,overall).
%cloth(dresses, dress3, orange, short, summer, pois,overall).
cloth(shirt, shirt1, darkBlue, long, summer, pois,top).
cloth(jackets, jackets1, darkBlue, short, summer, pois,coat).
%cloth(jackets, jackets2, darkBlue, long, summer, pois,coat).
%cloth(trousers, troisers1, darkGreen, short, summer, pois,bottom).
%cloth(overcoats, ov2, orange, short, summer, pois,coat).
%cloth(shoes, shoes1, orange, short, summer, pois,footwear).
cloth(sportshoes, sport2, darkBlue, long, summer, pois,footwear).
cloth(blouses, blouses2, darkBlue, short, summer, pois,top).
cloth(sweater, sweater2, darkBlue, long, summer, pois,top).
%cloth(trousers, troisers1, darkGreen, short, summer, pois,bottom).

%liste di colori definiti dall'utente
color_list(basic_dark_colors, [black, darkBlue, darkGrey, brown]).
color_list(basic_dark_colors2, [black2, darkBlue2, darkGrey2, brown2]).
color_list(basic_dark_colors3, [black3, darkBlue3, darkGrey3, brown3]).

%una lista per tutte le categorie
categories([dresses,overcoats,jackets,sweaters,blouses,tops,tshirts,trousers,skirts,suits,shoes,boots,sportshoes]).
%una lista vuota che dove verranno messe le categorie desiderate
%categories(Cat), WantedCategories = [], append(WantedCategories, boots, WantedCategories1).
%include_only
event_list([]). % quella che scrive l'utente

%exclude
deleteSubList([H|T],L,Z):- delete(H,L,FL), deleteSubList(T,FL,Z).
deleteSubList([],L,L).

%blocco della categoria 
%select(Category, Name, Color, Lenght, Season, Extra) :- cloth(Category,Name,Color,Lenght,Season,Extra).
color_rules(List):- color_list(List,X), not(member(Color,X)), not(member(Color,List)).
dressesCloth(L) :- bagof(cloth(dresses, Name, Color, short, summer, Extra), select(dresses, Name, Color, short, summer, Extra), L).
L :-[cloth(dresses,dress2,orange,short,summer,pois),cloth(dresses,dress3,orange,short,summer,pois)].
%ifthenelse block
select(Category,Name,Color,Lenght,Season,Extra,Attr):-cloth(Category,Name,Color,Lenght,Season,Extra),Lenght\==Attr.
mmproduct(M,N,R):- findall([X,Y],(member(X,M),member(Y,N)),R).
exclude(Cat1,Attr1,Cat2,Attr2,R):-bagof(cloth(Cat1,Name,Color,Attr1, Season, Extra),cloth(Cat1,Name,Color,Attr1,Season,Extra),L1),
bagof(cloth(Cat2,Name,Color,Lenght, Season, Extra),select(Cat2,Name,Color,Lenght,Season,Extra,Attr2),L2),
mmproduct(L1,L2,R).

sublist([H|T],L):- member(H,L), sublist(T,L).
sublist([],L). 

%escludere le tuple in base alle regole
cloth(A,B,C,D,E,F,overall),cloth(H,I,L,M,N,O,footwear),cloth(P,Q,R,S,T,U,coat).
(cloth(A,B,C,D,E,F,overall),cloth(H,I,L,M,N,O,footwear),cloth(P,Q,R,S,T,U,coat)).


%prime soluzioni di outfit
mmproduct(M,N,R):- findall([X,Y],(member(X,M),member(Y,N)),R).
%prima alternativa di soluzione,combinazione di tutte le categorie 
cartesianNsets([H|T],T,R):- mmproduct(H,[A|T],R).
create_list(L):- cloth(A,B,C,D,E,F,overall),cloth(H,I,L,M,N,O,footwear),cloth(P,Q,R,S,T,U,top). 


lista([cloth(A,B,C,D,E,F,overall),cloth(H,I,L,M,N,O,footwear),cloth(P,Q,R,S,T,U,top)]):- cloth(A,B,C,D,E,F,overall),cloth(H,I,L,M,N,O,footwear),cloth(P,Q,R,S,T,U,top).

risul(Z):- bagof(L,lista(L),New), exclude(dresses,long,jacket,long,R),write(R), sublist(R,L), deleteSubList(L,New,Z). 

